package Gui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.rmi.RemoteException;

import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.JTextPane;

import domein.server.IBuilder;

public class ForceUpdateHandler implements ActionListener{

	private JTextPane field;
	private IBuilder builder;
	private int clientID;
	
	public ForceUpdateHandler(JTextPane field, IBuilder builder, int id)
	{
		this.field = field;
		this.builder = builder;
		this.clientID = id;
	}
	
	@Override
	public void actionPerformed(ActionEvent e) {
		try {
			field.setStyledDocument((builder.read(clientID)));
			JOptionPane.showMessageDialog(null, "The update was succesfull");
		} catch (RemoteException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
	}


}
